package demo3;

import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        int[] nums={1,1};
        Solution solution = new Solution();
        System.out.println(solution.removeDuplicates(nums));
        System.out.println(Arrays.toString(nums));
    }
}
class Solution {
    public int removeDuplicates(int[] nums) {
        int num=nums.length;
        for (int i = 0; i < num-1; i++) {
            while(nums[i]==nums[i+1]&&i < num-1){
                for (int j = i; j < num-1; j++) {
                    nums[j]=nums[j+1];
                }
                num--;
            }
        }
        return num;
    }
}